package com.ava.avamedia.adapter;

import java.util.ArrayList;

import com.ava.avamedia.R;
import com.ava.avamedia.model.Cities;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CityAdapter extends BaseAdapter {
	Context ctx;
	ArrayList<Cities> cities;
	LayoutInflater mInflater;
	public CityAdapter(Context ctx, ArrayList<Cities> cities) {
		super();
		this.ctx = ctx;
		this.cities = cities;
		mInflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	public int getCount() {
		// TODO Auto-generated method stub
		return cities.size();
	}


	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return cities.get(arg0);
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		if (arg1 == null) {
			arg1 = mInflater.inflate(R.layout.adapter_region, null);
		}
		Cities city = (Cities) getItem(arg0);
		TextView txtName = (TextView) arg1.findViewById(R.id.adapter_region_name_region);
		txtName.setText(city.name);
		return arg1;
	}

}
